package com.example.famhealing.init;
//////////////수정필요

import java.util.ArrayList;

import com.example.famhealing.R;
import com.example.famhealing.R.id;
import com.example.famhealing.R.layout;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;

public class FamCompositionActivity extends Activity {
//	int[] img = {R.drawable.ic_launcher, R.drawable.ic_launcher, R.drawable.ic_launcher,
//			R.drawable.ic_launcher, R.drawable.ic_launcher, R.drawable.ic_launcher};
	String[] st = {"1", "2", "3", "4", "5", "6"};
	
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_fam_composition);

//		ArrayAdapter<Drawable> Adapter;
//		Adapter = new ArrayAdapter<Drawable>(this, android.R.layout.simple_list_item_1, img);
		ArrayAdapter<String> Adapter;
		Adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1,  st);

		ListView list = (ListView)findViewById(R.id.listView1);
		list.setAdapter(Adapter);
		list.setOnItemClickListener(mItemClickListener);
	}
	
	AdapterView.OnItemClickListener mItemClickListener = new AdapterView.OnItemClickListener() {
		public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
			Intent intent = new Intent(FamCompositionActivity.this, FamComposition1.class);
			intent.putExtra("position", position);
			intent.putExtra("member", "none");
			intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
			startActivity(intent);
			finish();
		}
	};
}
//public class FamCompositionActivity extends Activity{
//	ArrayList<Compos> famCompos;
//	public void onCreate(Bundle savedInstanceState) {
//		super.onCreate(savedInstanceState);
//		setContentView(R.layout.activity_fam_composition);
//
//		famCompos = new ArrayList<Compos>();
//		Compos fc;
//		fc = new Compos(R.drawable.ic_launcher, "부모와 자녀");famCompos.add(fc);
//		fc = new Compos(R.drawable.ic_launcher, "부부");famCompos.add(fc);
//		fc = new Compos(R.drawable.ic_launcher, "형제, 자매");famCompos.add(fc);
//		fc = new Compos(R.drawable.ic_launcher, "대가족");famCompos.add(fc);
//		fc = new Compos(R.drawable.ic_launcher, "1인 가족");famCompos.add(fc);
//		fc = new Compos(R.drawable.ic_launcher, "기타");famCompos.add(fc);
//
//		MyListAdapter MyAdapter = new MyListAdapter(this, R.layout.list, famCompos);
//
//		ListView MyList;
//		MyList=(ListView)findViewById(R.id.listView1);
//		MyList.setAdapter(MyAdapter);
//		MyList.setOnItemClickListener(mItemClickListener);
//		}
//		
//		AdapterView.OnItemClickListener mItemClickListener = new AdapterView.OnItemClickListener() {
//			public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
//				Intent intent = new Intent(FamCompositionActivity.this, FamComposition1.class);
//				intent.putExtra("position", position);
//				
////				if (position == 0)
////					intent = new Intent(FamCompositionActivity.this, FamComposition1.class);
////				else 
////					intent = new Intent(FamCompositionActivity.this, FamComposition2.class);
//				
//				startActivity(intent);
//			}
//		};
//
//	//리스트 뷰에 출력할 항목
//	class Compos {
//		Compos(int aIcon, String aName) {
//			Icon = aIcon;
//			Name = aName;
//		}
//		int Icon;
//		String Name;
//	}
//	
//	//어댑터 클래스
//	class MyListAdapter extends BaseAdapter {
//		Context maincon;
//		LayoutInflater Inflater;
//		ArrayList<Compos> arSrc;
//		int layout;
//	
//		public MyListAdapter(Context context, int alayout, ArrayList<Compos> aarSrc) {
//			maincon = context;
//			Inflater = (LayoutInflater)context.getSystemService(
//					Context.LAYOUT_INFLATER_SERVICE);
//			arSrc = aarSrc;
//			layout = alayout;
//		}
//	
//		public int getCount() {
//			return arSrc.size();
//		}
//	
//		public String getItem(int position) {
//			return arSrc.get(position).Name;
//		}
//	
//		public long getItemId(int position) {
//			return position;
//		}
//	
//		// 각 항목의 뷰 생성
//		public View getView(int position, View convertView, ViewGroup parent) {
//			final int pos = position;
//			
//			if (convertView == null) {
//				convertView = Inflater.inflate(layout, parent, false);
//			}
//			
//			ImageView img = (ImageView)convertView.findViewById(R.id.gf);
//			img.setImageResource(arSrc.get(position).Icon);
//	
//			return convertView;
//		}
//	}
//}